package thread;

public class Mytask {

    public static void main(String[] args) {
        SwapPrint print = new SwapPrint();
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 100; i += 2) {
                    print.printNumber(i);
                }
            }
        });
        thread1.setName("Thread t1");
        thread1.start();
        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 2; i <= 100; i += 2) {
                    print.printNumber(i);
                }
            }
        });
        thread2.setName("Thread t1");
        thread2.start();
    }
}
